package chan.project.smartlaweveryman.service;

import chan.project.smartlawmodel.dto.common.CommonInfoRegisterRequest;
import chan.project.smartlawmodel.dto.lawyer.LawyerInfoRegisterRequest;
import chan.project.smartlawmodel.dto.user.UserInfoQueryRequest;
import chan.project.smartlawmodel.entity.UserInfo;
import chan.project.smartlawmodel.vo.LoginUserVO;
import chan.project.smartlawmodel.vo.UserInfoVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletRequest;


import java.util.List;

/**
* @author 彭科文
* @description 针对表【user_info(用户信息表)】的数据库操作Service
* @createDate 2025-06-15 10:30:50
*/
public interface UserInfoService extends IService<UserInfo> {
    /**
     * 用户注册
     *
     * @param userAccount   用户账户
     * @param userPassword  用户密码
     * @param checkPassword 校验密码
     * @return 新用户 id
     */
    long userRegister(String userAccount, String userPassword, String checkPassword);

    /**
     * 普通用户注册
     * @return
     */
    long commonRegister(CommonInfoRegisterRequest commonInfoRegisterRequest);

    /**
     * 律师用户注册
     * @return
     */
    long lawyerRegister(LawyerInfoRegisterRequest lawyerInfoRegisterRequest);

    /**
     * 获取当前登录用户
     *
     * @param request
     * @return
     */
    UserInfo getLoginUser(HttpServletRequest request);

    /**
     * 获取当前登录用户（允许未登录）
     *
     * @param request
     * @return
     */
    UserInfo getLoginUserPermitNull(HttpServletRequest request);

    /**
     * 是否为管理员
     *
     * @param request
     * @return
     */
    boolean isAdmin(HttpServletRequest request);

    /**
     * 是否为管理员
     *
     * @param user
     * @return
     */
    boolean isAdmin(UserInfo user);

    /**
     * 用户注销
     *
     * @param request
     * @return
     */
    boolean userLogout(HttpServletRequest request);

    /**
     * 获取脱敏的已登录用户信息
     *
     * @return
     */
    LoginUserVO getLoginUserVO(UserInfo user);

    /**
     * 获取脱敏的用户信息
     *
     * @param user
     * @return
     */
    UserInfoVO getUserVO(UserInfo user);

    /**
     * 获取脱敏的用户信息
     *
     * @param userList
     * @return
     */
    List<UserInfoVO> getUserVO(List<UserInfo> userList);

    /**
     * 获取查询条件
     *
     * @param userQueryRequest
     * @return
     */
    QueryWrapper<UserInfo> getQueryWrapper(UserInfoQueryRequest userQueryRequest);

    /**
     * 基本用户登录接口
     * @param userAccount
     * @param userPassword
     * @return
     */
    LoginUserVO baseUserLogin(String userAccount, String userPassword,String userRole);

    /**
     * 普通用户登录
     * @param userAccount
     * @param userPassword
     * @return
     */
    LoginUserVO commonUserLogin(String userAccount, String userPassword);

    /**
     * 律师用户登录
     * @param userAccount
     * @param userPassword
     * @return
     */
    LoginUserVO lawyerUserLogin(String userAccount, String userPassword);

}
